package com.siki.vo;

import com.siki.pojo.model.User;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;
import java.util.Optional;

@ApiModel("报名界面信息返回")
@Getter
@Setter
@NoArgsConstructor
public class SignUpUserInfoVO {
    @ApiModelProperty("姓名")
    String name;

    @ApiModelProperty("性别")
    String userSex;

    @ApiModelProperty("学号")
    String number;

    @ApiModelProperty("班级")
    String classInfo;

    @ApiModelProperty("志愿信息")
    List<SignUpIntentionVO> signUpIntentionVOS;

    @ApiModelProperty("自我介绍")
    String selfIntroduction;

    @ApiModelProperty("对莞青的认识")
    String remark;

    @ApiModelProperty("电话")
    String phone;

    @ApiModelProperty("微信")
    String weChat;

    @ApiModelProperty("邮箱")
    String email;

    @ApiModelProperty("头像url")
    String avatarUrl;

    public SignUpUserInfoVO(User users){
        Optional.ofNullable(users).ifPresent(user -> {
            this.name = user.getName();
            this.signUpIntentionVOS = SignUpIntentionVO.getList(user.getDepartmentInformationList());
            this.selfIntroduction = user.getSelfIntroduction();
            this.userSex = user.getUserSex();
            this.remark = user.getRemark();
            this.phone = user.getPhone();
            this.weChat = user.getWeChat();
            this.number = user.getNumber();
            this.classInfo = user.getClassInfo();
            this.email = user.getEmail();
            this.avatarUrl = user.getAvatarUrl();
        });
    }
}
